package com.ruoyi.system.service.carte.trans.impl;

import cn.hutool.json.JSONUtil;
import com.ruoyi.system.domain.request.TransExecuteRequest;
import com.ruoyi.system.domain.request.TransRunRequest;
import com.ruoyi.system.service.carte.trans.ITransExecute;
import com.ruoyi.system.service.carte.trans.ITransRun;
import com.ruoyi.system.service.carte.trans.ITransTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TransTaskImpl implements ITransTask {

    @Autowired
    private ITransExecute transExecuteImpl;
    @Autowired
    private ITransRun transRunImpl;

    //没掉通
    @Override
    public String run(String jsonStr) throws Exception{
        TransRunRequest transRequest  =JSONUtil.toBean(jsonStr,TransRunRequest.class);
        return transRunImpl.runTrans(transRequest);
    }

    //正常work
    @Override
    public String exec(String jsonStr) throws Exception {
        TransExecuteRequest transRequest  =JSONUtil.toBean(jsonStr,TransExecuteRequest.class);
        return transExecuteImpl.executeTrans(transRequest);
    }
}
